#pragma once
#ifndef CURRENTTHREAD_H
#define CURRENTTHREAD_H
#include <sys/syscall.h>
#include <unistd.h>
namespace mymuduo {
namespace currentthread {
    extern __thread int t_cachedTid;

    void cacheTid();

    inline int tid() {
        if(__builtin_expect(t_cachedTid == 0, 0)) {
            cacheTid();
        }
        return t_cachedTid;
    }
}

}

#endif